Supplementary information

Methods

ICD-10 sub-chapter categories of mental disorders

The International Statistical Classification of Diseases and Related Health Problems, Tenth Revision (ICD-10) has been used in Finland since 1996. The 10 sub-chapter categories of mental disorders include: Abbreviation ICD-10 code Title of the category F0 F00-F09 Organic, including symptomatic, mental disorders F1 F10-F19 Mental and behavioural disorders due to psychoactive substance use F2 F20-F29 Schizophrenia, schizotypal and delusional disorders F3 F30-F39 Mood [affective] disorders; neurotic F4 F40-F48 Stress-related and somatoform disorders F5 F50-F59 Behavioural syndromes associated with physiological disturbances and physical factors F6 F60-F69 Disorders of adult personality and behaviour F7 F70-F79 Mental retardation F8 F80-F89 Disorders of psychological development F9 F90-F98 Behavioural and emotional disorders with onset usually occurring in childhood and adolescence

Conversion of the ICPC-2 International Classification of Primary Care diagnoses

According to the ICPC-2 manual,1 “ICPC is based on a simple bi-axial structure: 17 chapters based on body systems on one axis, each with an alpha code, and seven identical components with rubrics bearing a two-digit numeric code as the second axis”. Conditions listed in ICPC-2, chapter P: “Psychological” were included in this study. In the Finnish version of ICPC-2, the chapter P is translated to the Finnish equivalent of “mental health” not “psychological”·2 The Finnish version was used throughout the conversion process.

The conversion codes from ICPC-2 to ICD-10 are provided in the ICPC-2 manual and were adopted in this study. ICPC-2 concepts not represented exactly in the ICD-10 were included as a separate group of their own and are not included in the ICD-10 sub-chapter categories.

##Defining patient data with a history of mental health treatments

For every individual in the study, person-time at risk of death was dynamically labeled based on the history of mental health treatments.

Time spent in psychiatric inpatient care and the following year after the discharge date, and one year after any Secondary care psychiatric outpatient visits, was labeled as follow-up time with a one-year history of secondary mental health care. From exactly one year after the latest discharge, or the latest Secondary care outpatient contact, if still at risk of death, the individual no longer contributed to the Secondary care population and returned to either the population with a one-year history of Primary care, or the reference population with no one-year history of mental health treatments.

One year following any Primary care visit with a diagnosis of mental disorder was labeled as follow-up time with a one-year history of primary mental health care. Exactly one year after the latest Primary care contact, if still at risk of death and with no new Secondary care contacts, the individual returned to contributing to the reference population with no one-year history of mental health treatments. If a contact to Secondary care occurred during the follow-up time with a one-year history of Primary care, the individual’s follow-up time was relabeled to Secondary care based on the date of the Secondary care contact. If a Primary care contact emerged less than one year after the latest Secondary care contact, the follow-up time was relabeled to Primary care one year after the latest Secondary care contact, until one year had passed since the latest Primary care contact.

Main findigs

Age-standardized mortality rates (ASMRs) and mortality rate ratios (MRRs) in individuals with and without a one-year history of mental health treatments

aAge-standardized mortality rate per 1 000 person-years. Standardized to the 2013 European Standard Population by 5-year age groups. bModel 1: adjusted for Model 1: adjusted for calendar year and age group (5-year intervals). cModel 2: adjusted for Model 2: adjusted for calendar year, age group, urbanicity, region, education, living alone, household income, and economic activity. dModel 3: adjusted for Model 3: adjusted for calendar year, age group, and Charlson comorbidity index (CCI). eMortality in individuals with secondary care treatments compared to individuals without secondary care treatments (primary care ignored).

Figure 1. Mortality rate ratios in individuals with a one-year history of mental health treatments compared to individuals without such a history, stratified by mental disorder

## Warning: `gather_()` was deprecated in tidyr 1.2.0.
## Please use `gather()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
## Warning in is.na(ticktext): is.na() applied to non-(list or vector) of type
## 'expression'
## Warning: plotly.js does not (yet) support horizontal legend items 
## You can track progress here: 
## https://github.com/plotly/plotly.js/issues/53